<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>股票管理</title>
<%@include file="../static/include/head.jsp"%>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<script src="<%=request.getContextPath()%>/static/assets/global/scripts/metronic.js" type="text/javascript"></script>
<script src="<%=request.getContextPath()%>/static/assets/admin/layout/scripts/layout.js" type="text/javascript"></script>
<script src="<%=request.getContextPath()%>/static/assets/admin/layout/scripts/quick-sidebar.js" type="text/javascript"></script>
<script src="<%=request.getContextPath()%>/static/assets/admin/layout/scripts/demo.js" type="text/javascript"></script>

<link href="<%=request.getContextPath()%>/static/assets/global/plugins/datatables/plugins/bootstrap/dataTables.bootstrap.css" rel="stylesheet" type="text/css" />
<script src="<%=request.getContextPath()%>/static/assets/global/plugins/datatables/media/js/jquery.dataTables.min.js" type="text/javascript"></script>
<script src="<%=request.getContextPath()%>/static/assets/global/plugins/datatables/plugins/bootstrap/dataTables.bootstrap.js" type="text/javascript"></script>

<link href="<%=request.getContextPath()%>/static/assets/global/plugins/bootstrap-datepicker/css/datepicker.css" rel="stylesheet" type="text/css" />
<script src="<%=request.getContextPath()%>/static/assets/global/plugins/bootstrap-datepicker/js/bootstrap-datepicker.js" type="text/javascript"></script>

<script>
	jQuery(document).ready(function() {
		Metronic.init();
		Layout.init();
		QuickSidebar.init();
		Demo.init();
		$("#serchButton").click(function() {
			tableStockInit.fnDraw();
		});
		
		$('.date-picker').datepicker({
			language : 'cn',
			todayBtn : false,
			autoclose : true,
			forceParse : true,
			format : "yyyy-mm-dd"
		});
			
		var tableStockInit = $("#table_stock").dataTable({
				"paging" : true, //翻页功能
				"lengthChange" : true, //改变每页显示数据数量
				"searching" : false, //过滤功能
				"ordering" : true, //排序功能
				"order" : [ [ 0, "desc" ] ],
				"processing" : false,
				"serverSide" : true, //服务器数据
				"lengthMenu" : [ 10, 15, 30, 50 ],
				"pageLength" : 10,
				"language" : {
				"processing" : "努力加载中...",
				"search" : "搜索&nbsp;:",
				"lengthMenu" : "一页显示 _MENU_ 条数据",
				"info" : "当前第 _START_ 条到第 _END_ 条记录，共 _TOTAL_ 条记录",
				"loadingRecords" : "正在努力的加载数据...",
				"infoEmpty" : "当前第 0 条到第 0 条记录，共 0 条记录",
				"emptyTable" : "没有找到您查询的数据信息"
			},
			"ajax" : {
				"url" : "getStockTranscationPage",
				"type" : "POST",
				"data" : function(data) {
					data.stockName = $("#stockName").val();
					data.stockCode = $("#stockCode").val();
					data.storeNum = $("#storeNum").val();
					if(typeof($("#userName").val()) == "undefined"){
						data.userName = '${sessionScope.username}';
					}else{
						data.userName = $("#userName").val();
					}
					if('${userStockRlId}'!=''){
						data.userStockRlId = '${userStockRlId}';
					}
					if('${userName}'!=''){
						$("#userName").val('${userName}');
						data.userName = $("#userName").val();
					}
					data.status = $("#status").val();
				}
			},
			"columns" : [{
					"data" : "id"
				},{
					"data" : "userName"
				},{
					"data" : "stockCode"
				},{
					"data" : "stockName"
				},{
					"data" : "status"
				},{
					"data" : "operation"
				},{
					"data" : "operateNum"
				},{
					"data" : "value"
				},{
					"width": "120px",
					"data" : "createTime",
					render: function ( data, type, row ) {
						if(data!=null){
							return new Date(data).toLocaleString().replace("/","年").replace("/","月").replace(" ","日 ").split(" ")[0];
				        }else{
				        	return '';
				        }
				    }
				},{
					"orderable": false,
					"data" : null,
					"defaultContent" : "<div style='width:180'><button type='button' onclick='lookStockInit($(this))' class='btn blue btn-xs'>查看 <i class='fa fa-edit'></i></button>"+					
						"<shiro:hasRole name='admin'><button type='button' onclick='deleteStockInit($(this))' class='btn red btn-xs'>删除 <i class='fa fa-times'></i></button></shiro:hasRole>"+	
						/* "<button type='button' onclick='ignoreStockInit($(this))' class='btn red btn-xs'>忽略 <i class='fa fa-times'></i></button>"+ */
					"</div>"
				}]
		});
		
		$('input[name=stock_stockCode_edit]').change(function() { 
			stock_stockCode_edit_onchange();
		});  
		
	});
	
	function checkAmin(){
		var childnode = '<shiro:hasRole name="admin">admin</shiro:hasRole>';
		alert(childnode);
	}
	
	
 	// 查看按钮初始化
	function lookStockInit(item) {
 		clearInput();
		$("#edit_stock_btn").show();
	    $("#submit_stock_btn").hide();
	    $("#stockInfoTable input[type='text']").each(function(e){
	    	$(this).attr("readonly","readonly");
	    	$(this).attr("style","border:0px");
	    	$(this).css("background-color",$(this).parents('td').css('background-color'));
		 });
	    $("#stockInfoTable textarea").each(function(e){
	    	$(this).attr("readonly","readonly");
	    	$(this).attr("style","border:0px");
	    	$(this).css("background-color",$(this).parents('td').css('background-color'));
		 });
	    $("#stockInfoTable select").each(function(e){
	    	$(this).attr("readonly","readonly");
	    	$(this).attr("style","border:0px");
	    	$(this).css("background-color",$(this).parents('td').css('background-color'));
		});
	    
		$("#managerStock_title").text("查看股票交易详情");
		$("#managerStock_color").attr("class","portlet box blue");
        var tableRow = item.parents('tr')[0];
        var idTh = $(tableRow).children().get(0);
        $.post("<%=request.getContextPath()%>/getStockTranscationById", 
    		{ 
    			id: $(idTh).text()
    		}, 
    		function(json){
    			for(var index in json.data){
    				var val = json.data[index];
    				if(typeof($("#stock_"+index+"_edit")) != "undefined"){
    					if(index=='userStockRlId'){
    						var rl = json.data['rl'];
    						if(rl!=null){
    							$("#stock_userStockRlId_edit").append("<option value='"+rl.id+"' selected>"+rl.storeNum+"</option>");   	    					
    						}
    					}else if(index=='createTime'||index=='updateTime'){
    						var date = new Date(json.data[index]);
    						Y = date.getFullYear() + '-';
    						M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-';
    						D = date.getDate() + ' ';
    						h = date.getHours() + ':';
    						m = date.getMinutes() + ':';
    						s = date.getSeconds(); 
    						$("#stock_"+index+"_edit").val(Y+M+D);
    					}else{
        					$("#stock_"+index+"_edit").val(json.data[index]);
    					}
    				}
    			}
    			
				$("#managerStock_div").modal("show");
			},"json"
    	);
    };
	
    //新增按钮初始化
    function addStockInit() {
		clearInput();
		var userName = '${sessionScope.username}';
 		$("#stock_userName_edit").val(userName);
		$("#edit_stock_btn").hide();
	    $("#submit_stock_btn").show();
	    $("#stockInfoTable input[type='text']").each(function(e){
	    	$(this).removeAttr("readonly");
	    	$(this).removeAttr("style");
	    	$(this).css("background-color","");
		 });
	    
	    $("#stockInfoTable textarea").each(function(e){
	    	$(this).removeAttr("readonly");
	    	$(this).removeAttr("style");
	    	$(this).css("background-color","");
		 });
	    $("#stockInfoTable select").each(function(e){
	    	$(this).removeAttr("readonly");
	    	$(this).removeAttr("style");
	    	$(this).css("background-color","");
		 });
	    
		$("#managerStock_div").modal("show");
		$("#managerStock_title").text("修改股票交易资料");
		$("#managerStock_color").attr("class","portlet box yellow");	
		
		$("#stock_updateTime_edit").val(getNowFormatDate());
		$("#stock_status_edit").val("已完成");
    };
    
    
	// 修改按钮初始化
	function editStockInit() {
		$("#edit_stock_btn").hide();
	    $("#submit_stock_btn").show();
	    $("#stockInfoTable input[type='text']").each(function(e){
	    	$(this).removeAttr("readonly");
	    	$(this).removeAttr("style");
	    	$(this).css("background-color","");
		 });
	    $("#stockInfoTable textarea").each(function(e){
	    	$(this).removeAttr("readonly");
	    	$(this).removeAttr("style");
	    	$(this).css("background-color","");
		 });
	    $("#stockInfoTable select").each(function(e){
	    	$(this).removeAttr("readonly");
	    	$(this).removeAttr("style");
	    	$(this).css("background-color","");
		 });
		$("#managerStock_title").text("修改股票交易资料");
		$("#managerStock_color").attr("class","portlet box yellow");
		
		$("#stock_updateTime_edit").val(getNowFormatDate());
    };
    
 	// 删除按钮初始化
	function deleteStockInit(item) {
		$("#stock_id_delete").val("");
        var tableRow = item.parents('tr')[0];
        var idTh = $(tableRow).children().get(0);
        var stationNameTh = $(tableRow).children().get(4);
        var stationNewNumberTh = $(tableRow).children().get(1);
        var id = $(idTh).text();
        $("#stock_id_delete").val(id);
        var message = "您确定要删除编号:"+id+",的股票交易信息吗?(本操作不可恢复)"
        $("#deleteStock_p").text(message);
        $("#deleteStock_div").modal("show");
    };
	
 	// 忽略按钮初始化
	function ignoreStockInit(item) {
		$("#stock_id_ignore").val("");
        var tableRow = item.parents('tr')[0];
        var idTh = $(tableRow).children().get(0);
        var stationNameTh = $(tableRow).children().get(4);
        var stationNewNumberTh = $(tableRow).children().get(1);
        var id = $(idTh).text();
        $("#stock_id_ignore").val(id);
        var message = "您确定要忽略编号:"+id+",的股票交易信息吗?(本操作不可恢复)"
        $("#ignoreStock_p").text(message);
        $("#ignoreStock_div").modal("show");
    };
    
 	// 忽略基站提交
	function ignore_stock(){
		$.post("<%=request.getContextPath()%>/ignoreById", 
	    	{ 
				id:$("#stock_id_ignore").val()
	    	}, 
	    	function(result){
	    		if(result == -1){
					alert("系统内部错误,请与管理员联系！");
					$("#ignoreStock_div").modal("hide");
					$("#stock_id_delete").val("");
					$("#table_stock").dataTable().fnDraw();
				}else if(result == 0){
					alert("忽略股票交易信息成功！");
					$("#ignoreStock_div").modal("hide");
					$("#stock_id_ignore").val("");
					$("#table_stock").dataTable().fnDraw();
				}
			}
	    );
	}
    
	//简单校验用户输入
	function submit_validation(){
		var obj = new Object();
		$("#stockInfoTable input[type='text']").each(function(e){
			var stationId = $(this).attr("id");
		    var idArray = stationId.split('_');
		    obj[idArray[1]] = $(this).val();
		 });
		var id = $("#stock_id_edit").val();
		
		$("#stockInfoTable select").each(function(e){
		    var inputId = $(this).attr("id");
		    var idArray = inputId.split('_');
		    if($(this).val()!=''){
			    obj[idArray[1]] = $(this).val();
		    }
		});
		
		$("#stockInfoTable textarea").each(function(e){
		    var inputId = $(this).attr("id");
		    var idArray = inputId.split('_');
		    if($(this).val()!=''){
			    obj[idArray[1]] = $(this).val();
		    }
		});
		
		if($("#stock_status_edit").val()==''){
			alert('请选择交易状态');
			return;
		}else{
			if($("#stock_status_edit").val()=='已完成'&&$("#stock_value_edit").val()==''){
				alert('请输入成交价格');
				return;
			}
			if($("#stock_status_edit").val()=='已完成'&&$("#stock_createTime_edit").val()==''){
				alert('请选择交易时间');
				return;
			}
			
			if($("#stock_operation_edit").val()=='首补'||$("#stock_operation_edit").val()=='二次补仓'||$("#stock_operation_edit").val()=='卖出'
					||$("#stock_operation_edit").val()=='现金分红'||$("#stock_operation_edit").val()=='股票分红'){
				var storeNum = $("#stock_userStockRlId_edit").find("option:selected").text();
				if(storeNum==''){
					alert('请选持仓编码！');
					return;
				}
			}
		}
		
		//校验仓编码和年份
		var storeNum = $("#stock_userStockRlId_edit").find("option:selected").text();
		var years = $("#stock_years_edit").val();
		
		var store_year = storeNum.split("_");
		
		if(store_year[2]!=years&&store_year[2]!=undefined){
			alert("傻x 你年份输入错了！");
			return;
		}
		
		//验证编码和股票名称一致
		var code = $("#stock_stockCode_edit").val();
		var validateObj = new Object();
		var validate = true;
		validateObj.stockCode = code;
		validateObj.userId = ${sessionScope.id};
		$.ajax({
			type:"POST",
			url:"<%=request.getContextPath()%>/checkStockNo",
			data:validateObj,
			dataType :'json',
			async: false,
			timeout:"20000",
			success:function(rs,textStatus){
				var msg = rs.msg;
				var code = rs.code;
				if(code == 0 && 'succ' == msg){
					var stock = rs.stock;
					if($("#stock_stockName_edit").val()!=stock.name){
						alert("股票编码与股票名称不一致！");
						validate = false;
						return;
					}
					/* $("#stock_stockName_edit").val(stock.name); */
				}else{
					alert(rs.data);
				}				
			},
			error : function(XMLResponse) {
				alert("提交超时请检查网络环境");
				$("#managerBill_div").modal("hide");
				$("#table_bill").dataTable().fnDraw();
			}
		});
		if(id ==''){
			if(validate == true){
				save_stock(obj);
			}else{
				return;
			}
		}else{
			if(validate == true){
				update_stock(obj);
			}else{
				return;
			}
		}
		clearInput();
	}
	
	// 更新基站提交
	function update_stock(obj){
		$.post("<%=request.getContextPath()%>/updateStockTranscation",obj, 
	    	function(result){
	    		if(result == -1){
					alert("系统内部错误,请与管理员联系！");
					$("#managerStock_div").modal("hide");
					$("#table_stock").dataTable().fnDraw();
				}else if(result == 0){
					alert("修改股票交易信息成功！");
					$("#managerStock_div").modal("hide");
					$("#table_stock").dataTable().fnDraw();
				}
			}
	    );
	}
	
	// 增加电费提交
	function save_stock(obj){
		$.ajax({
			type:"POST",
			url:"<%=request.getContextPath()%>/addStockTranscation",
			data:obj,
			dataType :'json',
			timeout:"20000",
			success:function(data,textStatus){
				var msg = data.msg;
				var code = data.code;
				if(code == 0 && 'succ' == msg){
					alert("保存成功");
					$("#managerStock_div").modal("hide");
					$("#table_stock").dataTable().fnDraw();
				}				
			},
			error : function(XMLResponse) {
				alert("提交超时请检查网络环境");
				$("#managerStock_div").modal("hide");
				$("#table_stock").dataTable().fnDraw();
			}
		});
	}
	
	// 删除基站提交
	function delete_stock(){
		$.post("<%=request.getContextPath()%>/deleteStockTranscationById", 
	    	{ 
				id:$("#stock_id_delete").val()
	    	}, 
	    	function(result){
	    		if(result == -1){
					alert("系统内部错误,请与管理员联系！");
					$("#deleteStock_div").modal("hide");
					$("#stock_id_delete").val("");
					$("#table_stock").dataTable().fnDraw();
				}else if(result == 0){
					alert("删除股票交易信息成功！");
					$("#deleteStock_div").modal("hide");
					$("#stock_id_delete").val("");
					$("#table_stock").dataTable().fnDraw();
				}
			}
	    );
	}
	
	function stock_stockCode_edit_onchange(){
		var obj = new Object();
		$("#stockInfoTable input[type='text']").each(function(e){
			var stationId = $(this).attr("id");
		    var idArray = stationId.split('_');
		    obj[idArray[1]] = $(this).val();
		 });
		obj.userId = ${sessionScope.id};
		obj.userName = $("#stock_userName_edit").val();
		$.ajax({
			type:"POST",
			url:"<%=request.getContextPath()%>/checkStockNo",
			data:obj,
			dataType :'json',
			timeout:"20000",
			success:function(rs,textStatus){
				var msg = rs.msg;
				var code = rs.code;
				if(code == 0 && 'succ' == msg){
					var stock = rs.stock;
					$("#stock_stockName_edit").val(stock.name);
					$.each(rs.data, function(idx, obj) {
						$("#stock_userStockRlId_edit").html("");
						$("#stock_userStockRlId_edit").append("<option value='"+obj.id+"'>"+obj.storeNum+"</option>"); 
						$("#stock_userStockRlId_edit").val(obj.stockName);
					});
				}else{
					alert(rs.data);
				}				
			},
			error : function(XMLResponse) {
				alert("提交超时请检查网络环境");
				$("#managerBill_div").modal("hide");
				$("#table_bill").dataTable().fnDraw();
			}
		});
	}
	
	function analyze(){
		var obj = new Object();		
		alert('提醒开始计算，请稍后！');
		$.ajax({
			type:"POST",
			url:"<%=request.getContextPath()%>/analyze",
			data:obj,
			dataType :'json',
			timeout:"2000000",
			success:function(rs,textStatus){
				var msg = rs.msg;
				var code = rs.code;
				if(code == 0 && 'succ' == msg){
					alert('提醒生成成功！');
				}else{
					alert('失败!');
				}				
			},
			error : function(XMLResponse) {
				alert("提交超时请检查网络环境");
				$("#managerBill_div").modal("hide");
				$("#table_bill").dataTable().fnDraw();
			}
		});
	}
	
	function clearInput(){
		$("#stockInfoTable input[type='text']").each(function(e){
			$(this).val("");
		});
		
		$("#stockInfoTable select").each(function(e){
			$(this).val("");
		});
		
		$("#stock_userStockRlId_edit").empty();
		$("#stock_userStockRlId_edit").append("<option value=''>请选择</option>"); 
	}
	
	function toUpload(){
		window.location.href = "<%=request.getContextPath()%>/toUploadStock";
	}
	
	function getNowFormatDate() {
	    var date = new Date();
	    var seperator1 = "-";
	    var seperator2 = ":";
	    var year = date.getFullYear();
	    var month = date.getMonth() + 1;
	    var strDate = date.getDate();
	    if (month >= 1 && month <= 9) {
	        month = "0" + month;
	    }
	    if (strDate >= 0 && strDate <= 9) {
	        strDate = "0" + strDate;
	    }
	    var currentdate = year + seperator1 + month + seperator1 + strDate;
	            /* + " " + date.getHours() + seperator2 + date.getMinutes()
	            + seperator2 + date.getSeconds(); */
	    return currentdate;
	}
</script>
</head>
<body class="page-header-fixed page-quick-sidebar-over-content">
	<%@include file="../static/include/header.jsp"%>
	<div class="clearfix"></div>
	<div class="page-container">
		<%@include file="../static/include/sidebar.jsp"%>
		<!-- BEGIN CONTENT -->
		<div class="page-content-wrapper">
			<div class="page-content">
				<!-- BEGIN STYLE CUSTOMIZER -->
				<%@include file="../static/include/styles.jsp"%>
				<!-- END STYLE CUSTOMIZER -->
				<div class="row">
					<div class="col-md-12">
						<!-- BEGIN PAGE HEADER-->
						<h3 class="page-title">
							股票管理 <small>股票持有条目一览</small>
						</h3>
						<div class="page-bar">
							<ul class="page-breadcrumb">
								<li><i class="fa fa-home"></i> <a href="index">主页</a> <i class="fa fa-angle-right"></i></li>
								<li><a href="stockManager">股票管理</a></li>
							</ul>
						</div>
						<!-- END PAGE HEADER-->
						<!-- BEGIN ROW -->
						<div class="portlet box blue-madison">
							<div class="portlet-title">
								<div class="caption">
									<i class="fa fa-user"></i>股票交易信息
								</div>
								<div class="tools">
									<a href="javascript:;" class="collapse"></a>
								</div>
							</div>
							<div class="portlet-body">
								<div>
									<ul class="nav nav-tabs">	
										<shiro:hasRole name='admin'>									
											<li style="float: left">
												<button type="button" onclick="addStockInit()" class="btn green">
													新增 <i class="fa fa-plus"></i>
												</button>
												<button type="button" onclick="analyze()" class="btn yellow">
													生成提醒 <i class="fa fa-plus"></i>
												</button>
											</li>
										</shiro:hasRole>
										<li style="float: right; margin-left: 5px">
											<button id="serchButton" type="button" class="btn green">搜索</button>
										</li>
										<li style="float: right; margin-left: 5px"><input id="stockCode" type="text" class="form-control" placeholder="请输入股票编码"></li>
										<li style="float: right"><input id="stockName" type="text" class="form-control" placeholder="请输入股票名称"></li>
										<li style="float: right"><input id="storeNum" type="text" class="form-control" placeholder="请输入持仓编码"></li>
										<shiro:hasRole name="admin">
											<li style="float: right"><input id="userName" type="text" class="form-control" value="${sessionScope.username}"/></li>
										</shiro:hasRole>
										<li style="float: right">
											<select class="form-control" id="status">
												<option value="" selected="selected">请选择</option>  
												<option value="未完成">未完成</option>
												<option value="已完成">已完成</option>
												<option value="已忽略">已忽略</option>
											</select>
										</li>
									</ul>
									<div class="tab-pane fade active in" id="tab_1_1">
										<table id="table_stock" class="table table-striped table-hover table-bordered">
											<thead>
												<tr>
													<th>编号</th>
													<th>用户名称</th>
													<th>编码</th>
													<th>名称</th>
													<th>状态</th>
													<th>操作</th>
													<th>操作数量</th>
													<th>交易价格</th>
													<th>交易日期</th>
													<th>其他</th>
												</tr>
											</thead>
											<tbody>
											</tbody>
										</table>
									</div>
								</div>
							</div>
						</div>
						<!-- END ROW -->
					</div>
				</div>
			</div>
			<!-- END CONTENT -->
		</div>
	</div>
	<%@include file="../static/include/footer.jsp"%>
	<!-- modal BEGIN -->
	<div id="managerStock_div" class="modal fade" tabindex="-1" aria-hidden="true">
		<div class="modal-dialog">
			<div id="managerStock_color" class="portlet box blue" style="width: 900px">
				<div class="portlet-title">
					<div class="caption">
						<i class="fa fa-user"></i>股票管理
					</div>
					<div id="managerBill_title" class="tools"></div>
				</div>
				<div class="portlet-body form">
					<div class="form-body">
						<table style="margin: 3px" class="table table-striped table-hover table-bordered" id="stockInfoTable">
							<tr hidden="true">
								<td>编号</td>
								<td><input class="col-md-12" id="stock_id_edit" type="text" readonly="readonly"></input></td>
								<td></td>
								<td></td>
							</tr>
							<tr>
								<td>股票名称</td>
								<td><input class="col-md-12" id="stock_stockName_edit" type="text"></input></td>
								<td>股票编码</td>
								<td><input class="col-md-12" id="stock_stockCode_edit" name="stock_stockCode_edit" type="text"></input></td>
							</tr>
							<tr>
								<td>持仓编码</td>
								<td>
									<!-- <input class="col-md-12" id="stock_storeNum_edit" type="text"></input> -->	
									<select class="form-control" id="stock_userStockRlId_edit">
										<option value="" selected="selected">请选择</option>										
									</select>						
								</td>
								<td>年份</td>
								<td>
									<!-- <input class="col-md-12" id="stock_year_edit" type="text"/> -->
									<select class="form-control" id="stock_years_edit">
										<option value="" selected="selected">请选择</option>  
										<option value="2015">2015</option>
										<option value="2016">2016</option>
										<option value="2017">2017</option>
										<option value="2018">2018</option>
										<option value="2019">2019</option>
									</select>
								</td>
							</tr>
							<tr>
								<td>账户名称</td>
								<td><input class="col-md-12" id="stock_userName_edit" type="text"></input></td>
								<td>操作类型</td>
								<td>
									<select class="form-control" id="stock_operation_edit">
										<option value="" selected="selected">请选择</option>  
										<option value="建仓">建仓</option>
										<option value="首补">首补</option>
										<option value="二次补仓">二次补仓</option>
										<option value="卖出">卖出</option>
										<option value="现金分红">现金分红</option>
										<option value="现金分红">股票分红</option>
									</select>
								</td>
							</tr>
							<tr>
								<td>状态</td>
								<td>
									<!-- <input id="stock_status_edit" name="stock_status_edit"  type="text"/> -->
									<select class="form-control" id="stock_status_edit">
										<option value="" selected="selected">请选择</option>  
										<option value="未完成">未完成</option>
										<option value="已完成">已完成</option>
									</select>
								</td>
								<td>操作数量</td>
								<td><input class="col-md-12" id="stock_operateNum_edit" type="text"></input></td>
							</tr>
							<tr>
								<td>建议价格</td>
								<td><input class="col-md-12" id="stock_suggestValue_edit" type="text" readonly="readonly"></input></td>
								<td>成交价格</td>
								<td><input class="col-md-12" id="stock_value_edit" type="text" readonly="readonly"></input></td>
							</tr>	
							<tr>
								<td>交易日期</td>
								<td><input id="stock_createTime_edit" name="stock_createTime_edit" class="input-medium date-picker" type="text" /> <!-- <input class="col-md-12" id="bill_currentTime_edit" type="text"></input> --></td>
								<td>修改日期</td>
								<td><input id="stock_updateTime_edit" name="stock_updateTime_edit" class="input-medium date-picker" type="text" /> <!-- <input class="col-md-12" id="bill_currentTime_edit" type="text"></input> --></td>
							</tr>												
							<tr>
								<td>备注</td>
								<!-- <td colspan="3"><input class="col-md-12" id="stock_remark_edit" type="text"></input></td> -->
								<td colspan="3" ><textarea rows="3" cols="20" class="col-md-12" id="stock_description_edit"></textarea></td>
							</tr>
						</table>
					</div>
					<div class="form-actions right">
						<button type="button" data-dismiss="modal" class="btn default" onclick="clearInput()" >返回</button>
						<shiro:hasRole name='admin'>
							<button id="edit_stock_btn" type="button" onclick="editStockInit()" class="btn yellow" hidden="true">修改</button>
							<button id="submit_stock_btn" type="button" onclick="submit_validation()" class="btn green">提交</button>
						</shiro:hasRole>
					</div>
				</div>
			</div>
		</div>
	</div>
	<!-- modal END -->

	<!-- modal BEGIN -->
	<div id="deleteStock_div" class="modal fade" tabindex="-1" aria-hidden="true">
		<div class="modal-dialog">
			<div class="portlet box red">
				<div class="portlet-title">
					<div class="caption">
						<i class="fa fa-user"></i>股票管理
					</div>
					<div class="tools">删除账户股票</div>
				</div>
				<div class="portlet-body form">
					<div class="form-body">
						<input class="col-md-10" id="stock_id_delete" type="text" readonly="readonly" hidden="true"></input>
						<p id="deleteStock_p"></p>
					</div>
					<div class="form-actions right">
						<button type="button" data-dismiss="modal" class="btn default" >返回</button>
						<button type="button" onclick="delete_stock()" class="btn red">删除</button>
					</div>
				</div>
			</div>
		</div>
	</div>
	<!-- modal END -->
	
	<!-- modal BEGIN -->
	<div id="ignoreStock_div" class="modal fade" tabindex="-1" aria-hidden="true">
		<div class="modal-dialog">
			<div class="portlet box red">
				<div class="portlet-title">
					<div class="caption">
						<i class="fa fa-user"></i>股票管理
					</div>
					<div class="tools">忽略账户股票</div>
				</div>
				<div class="portlet-body form">
					<div class="form-body">
						<input class="col-md-10" id="stock_id_ignore" type="text" readonly="readonly" hidden="true"></input>
						<p id="ignoreStock_p"></p>
					</div>
					<div class="form-actions right">
						<button type="button" data-dismiss="modal" class="btn default" >返回</button>
						<button type="button" onclick="ignore_stock()" class="btn red">忽略</button>
					</div>
				</div>
			</div>
		</div>
	</div>
	<!-- modal END -->
</body>
</html>
